CC=gcc
AR=ar
INCPATH=-I ../h
OUTLIBPATH=../lib
CFLAGS=-Wall -g -DNDEBUG -D_GNU_SOURCE $(INCPATH) -fPIC

INCLIB_P=-L../lib -lpthread 
CFLAGS_P=-Wall -g $(INCPATH)

OBJS:=uc_prcom.o
OBJSP:=uc_prcom_test.o

PROGNAME=prcom

ifdef X64
	LIBNAME=libucprcom_x64.a
	INCLIB_P+= -lucprcom_x64 -lrt
else ifdef UBT_X64
	LIBNAME=libucprcom_ubt_x64.a
	INCLIB_P+= -lucprcom_ubt_x64 -lrt
else
	LIBNAME=libucprcom.a
	INCLIB_P+= -lucprcom -lrt
endif

all: $(LIBNAME) $(PROGNAME)

$(LIBNAME): $(OBJS)
	$(AR) cr $(OUTLIBPATH)/$(LIBNAME) $(OBJS) $(INCLIB)

$(PROGNAME): $(OBJSP)
	$(CC) $(CFLAGS_P) -o $(PROGNAME) $(OBJSP) $(INCLIB_P)

clean:
	-rm -f *.o $(LIBNAME) $(PROGNAME)

